function getDateStr(today, addDayCount) {
  var date;
  if (today) {
    date = new Date(today);
  } else {
    date = new Date();
  }
  date.setDate(date.getDate() + addDayCount); //获取AddDayCount天后的日期 
  var y = date.getFullYear();
  var m = date.getMonth() + 1; //获取当前月份的日期 
  var d = date.getDate();
  if (m < 10) {
    m = '0' + m;
  };
  if (d < 10) {
    d = '0' + d;
  };
  // console.log(y + "-" + m + "-" + d)
  return y + "-" + m + "-" + d;
}

function getIntervalTime(today, addDayCount) {
  var date;
  if (today) {
    date = new Date(today);
  } else {
    date = new Date();
  }
  date.setDate(date.getDate() + addDayCount); //获取AddDayCount天后的日期 
  var y = date.getFullYear();
  var m = date.getMonth() + 1; //获取当前月份的日期 
  var d = date.getDate();
  var H = date.getHours();
  //分
  var M = date.getMinutes();
  //秒
  var S = date.getSeconds();
  if (m < 10) {
    m = '0' + m;
  };
  if (d < 10) {
    d = '0' + d;
  };
  if(H<10){
    H='0'+H
  };
  if(M<10){
    M='0'+M
  };
  if(S<10){
    S='0'+S
  };
  // console.log(y + "-" + m + "-" + d)
  return y + "-" + m + "-" + d + " " + H + ":" + M+ ":" + S;
}
module.exports = {
  timeHandle: getDateStr,
  IntervalTime:getIntervalTime
}